<?php
/**
 * Talents come from diligence, and knowledge is gained by accumulation.
 *
 * @author: 晋<657306123@qq.com>
 */

namespace Xin\Robot\Facades;

if (class_exists(\Illuminate\Support\Facades\Facade::class)) {
	class Facade extends \Illuminate\Support\Facades\Facade
	{

	}
} elseif (class_exists(\think\Facade::class)) {
	class Facade extends \think\Facade
	{

	}
}

/**
 * @method \Xin\Robot\Contracts\Robot robot($name = null) static
 * @method bool sendMessage(array $message, array $mentionedList = null) static
 * @method bool sendTextMessage(string $content, array $mentionedList = null, array $attributes = []) static
 * @method bool sendMarkdownMessage($content, array $mentionedList = null, array $attributes = []) static
 * @method bool sendFeedCardMessage($articles, array $mentionedList = null, array $attributes = []) static
 * @see \Xin\Robot\Contracts\Factory
 * @see \Xin\Robot\Contracts\Robot
 */
class Robot extends Facade
{

	/**
	 * 获取当前Facade对应类名（或者已经绑定的容器对象标识）
	 *
	 * @access protected
	 * @return string
	 */
	protected static function getFacadeClass()
	{
		return 'robot';
	}

	/**
	 * 获取组件的注册名称。
	 *
	 * @return string
	 */
	protected static function getFacadeAccessor()
	{
		return 'robot';
	}

	/**
	 * 选用默认类型机器人
	 * @return \Xin\Robot\Contracts\Robot
	 */
	public static function viaDefault()
	{
		return static::robot();
	}

	/**
	 * 选用告警类型机器人
	 * @return \Xin\Robot\Contracts\Robot
	 */
	public static function viaDanger()
	{
		return static::robot('danger');
	}

	/**
	 * 选用通知类型机器人
	 * @return \Xin\Robot\Contracts\Robot
	 */
	public static function viaInfo()
	{
		return static::robot('info');
	}
}
